
local CGUniform = CGUniform or {}
CGUniform.__index = CGUniform

function CGUniform.new()
    local self = setmetatable({}, CGUniform)
    self.inputs = {}
    self.nexts = {}
    self.Uniform = {}
    self.valueType = nil
    return self
end

function CGUniform:setInput(index, func)
    self.inputs[index] = func
end

function CGUniform:setNext(index, func)
    self.nexts[index] = func
end

function CGUniform:getOutput(index)
    local v1 = self.inputs[0]() or "name"
    local v2 = self.inputs[1]() or 0.0

    self.Uniform["name"]=v1
    self.Uniform["value"]=v2
    self.Uniform["valueType"]=self.valueType
    return self.Uniform
end

function CGUniform:update(index)
    local v1 = self.inputs[0]() or "name"
    local v2 = self.inputs[1]() or 0.0

    self.Uniform["name"]=v1
    self.Uniform["value"]=v2
    self.Uniform["valueType"]=self.valueType
    if self.nexts[0] ~= nil then
        self.nexts[0]()
    end
end

return CGUniform